package com.pattern.design.designpattern.Diedaiqi;

import java.util.List;

/**
 * author:harisucici on 2018/10/10 17:42
 * email:harisucici@gmail.com
 * name:
 * todo:
 */
public class CompanyADiedaiqi implements Diedaiqi {
    private List<Employee> list;
    private int position;

    /**
     * Instantiates a new Company a diedaiqi.
     *
     * @param l the l
     */
    public CompanyADiedaiqi(List<Employee> l){
        this.list = l;
    }
    @Override
    public boolean hasNext() {
        if ((position>list.size()-1)||list.get(position) == null){
            return false;
        }else{
            return true;
        }
    }

    @Override
    public Employee getEmployee() {
        Employee employee = list.get(position);
        position++;
        return employee;
    }
}
